import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { UserComponent } from './user.component';
import { UserProfileComponent } from './user-profile/user-profile.component';
import { UserTableComponent } from './user-table/user-table.component';

const routes: Routes = [{
  path: '',
  component: UserComponent,
  children: [
    { path: '', redirectTo: 'usertable/page/1', pathMatch: 'full' },
    { path: 'usertable/page/:page', component: UserTableComponent },
    { path: 'usertable/edituser/:id', component: UserProfileComponent },
    { path: 'usertable/newuser', component: UserProfileComponent },
  ]
}];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class UserRoutingModule { }
